<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<script>
    function checkUsername(){
        var usernameReg=/^[a-zA-Z0-9]{5,10}$/
        var usernameInput=document.getElementById("usernameInput")
        var username=usernameInput.value
        var usernameMsg=document.getElementById("usernameMsg")
        if(!usernameReg.test(username)){
            usernameMsg.innerText="用户名格式错误";
            return false;
        }
        usernameMsg.innerText="OK";
        return true;
    }

    function checkUserPwd(){
        var userPwdReg=/^[0-9]{6}$/
        var userPwdInput=document.getElementById("userPwtInput")
        var userPwd=userPwdInput.value
        var userPwdMsg=document.getElementById("userPwdMsg")
        if(!userPwdReg.test(userPwd)){
            userPwdMsg.innerText="密码格式错误";
            return false;
        }
        userPwdMsg.innerText="OK";
        return true;

        
    }
    function checkForm(){
        var flag1=checkUsername()
        var flag2=checkUserPwd()
        return flag1&&flag2
    }
</script>


</head>
<body>
    <h1 class="ht">欢迎使用日程管理系统</h1>
    <h3 class="ht">请登录</h3>
    <form method="post" action="" onsubmit="return checkForm()">
        <table class="tab" cellspacing="0px">
            <tr class="ltr">
                <td>请输入账号：</td>
                <td>
                    <input type="text" class="ipt" id="usernameInput" name="username" onblur="checkUsername()">
                    <span id="usernameMsg"></span>
                </td>  
            </tr>
            <tr class="ltr">
                <td>请输入密码：</td>
                <td>
                    <input type="password" name="userPwd" id="userPwtInput" class="ipt" onblur="checkUserPwd()">
                    <span id="userPwdMsg"></span>
                </td>
            </tr>
            <tr class="ltr">
                <td colspan="2" class="buttonContainer">
                    <input class="btn1" type="submit" value="登陆">
                    <input type="reset" class="btn1" value="重置">
                    <button class="btn1"> <a href="/regist.html">去注册</a></button>

                </td>

            </tr>




        </table>








    </form>
    
</body>
</html>